# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=libsass
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.6.4
pkgrel=1
pkgdesc="C implementation of Sass CSS preprocessor (library) (mingw-w64)"
arch=('any')
url="http://libsass.org/"
license=("MIT")
options=('strip' 'staticlibs')
source=("$_realname-$pkgver.tar.gz::https://github.com/sass/$_realname/archive/$pkgver.tar.gz")
sha256sums=('f9484d9a6df60576e791566eab2f757a97fd414fce01dd41fc0a693ea5db2889')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  autoreconf -vfi
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
